//https://leetcode.cn/problems/rotate-array/?envType=study-plan-v2&envId=top-100-liked

#include <vector>
#include <stack>
#include <list>
#include <map>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;


// 反转数组元素
//https://blog.csdn.net/weixin_44566432/article/details/113202411
class Solution {
public:
    static void rotate(vector<int>& nums, int k) {
        k = k % nums.size();
        reverse(nums.begin(), nums.end());
        reverse(nums.begin(), nums.begin() + k);
        reverse(nums.begin() + k, nums.end());
    }
};